1. Field of the Invention
This invention relates to using digital hardware to generate a sequence of values representing points on an exponential or pseudo-exponential decay curve.
2. Description of Related Art
Exponential decays occur frequently in nature and are often emulated by digital hardware. Music synthesizers are a prime example of digital signal processors which emulate exponential decays. Music synthesizers often generate ADSR (attack, decay, sustain, and release) curves which include exponential decay sections that mimic the drop in volume of a musical note. For example, a synthesizer which emulates a piano typically generates a sound envelope which decreases exponentially as the volume of a struck note dies out. The duration of the exponential decay depends upon the note and can last as long as thirty seconds or more for the deepest notes on a piano.
Mathematically, an exponential decay can be expressed as a function of time EQU x(t)=x.sub.0 *r.sup..alpha.t (eq. 1)
where x(t) is the decay function at time t, x.sub.0 is the initial value of the decay function (at time t=0), .alpha. is a constant with dimensions of inverse time, and r is a fixed exponential base less than one. The constant .alpha. and exponential base r determine the rate-of-decease characteristic of the decay function x(t).
For digital processors, time t takes on discrete values, typically an integer n times a constant sampling period .tau.. Accordingly, the decay function is a series of values EQU x.sub.n =x(n*.tau.)=x.sub.0 *r.sup..alpha.n.tau. =x.sub.0 *nR(eq. 2)
where a new exponential base R equals r.sup..alpha..tau. and is less than one. Eq. 2 can be reformulated as an iterative relation EQU x.sub.n =(x.sub.0 *R.sup.n-1)*R=x.sub.n-1 *R (eq. 3)
For the standard CD (compact disk) sampling rate of 44.1 KHz, the sampling period T is about 2.27.times.10.sup.-5 seconds. Such sampling periods result in exponential bases R that are very close to one, especially for long decay times. Assuming that a sound envelope provides 16-bit values with an initial maximum value of 65536 which decays to the minimum non-zero value of 1 in 30 second, eq. 2 requires that EQU x.sub.n =1=x.sub.0 *R.sup.n =65,536*R.sup.(30 seconds.times.44.1 Khz).
As a result, R is 0.999991617. The closest 16-bit value to 0.999991617 is 65,535/65,536=0.999984741, which, in sq. 2, only yields a 20 second decay. To provide a 30 second decay, more than sixteen bits are required to represent R, and a multiplier with an input bus larger than 16-bits is required to determine decay function values if the multiplication in eq. 3 is carried out in a single step.
Truncation error in digital calculations further complicates accurate generation of an exponential decay. Truncating the product x.sub.n-1 *R to sixteen bits decreases the decay function by one every sampling period, and provides a linear decrease from 65,536 to 0. The resulting total decay time is only 1.49 seconds at a 44.1-KHz sampling rate. At least 20-bit values x.sub.n and a multiplier with a 20-bit input bus are required to achieve a 16-bit decay function with a 30 second decay, but even with 20-bit values, truncation of products to 20 bits results in a linear, not exponential, decay. Still larger multipliers are required to provide an acceptable 16-bit approximation of an exponential decay. Such multipliers are expensive and often slow.
Accordingly, methods and circuits are needed that permit fast calculation of exponential decay functions using smaller or no multipliers.